	<form>
		<div class="wrapper index-wrapper upload-wrapper">
			<div class="logo">
				<img class="img-responsive" src="images/chengyi/story-logo.png" alt="">
			</div>
			<div class="ring">
				<img class="img-responsive" src="images/chengyi/img.png" alt="">
			</div>
			<div class="ring">
				<img class="img-responsive" src="images/chengyi/ring.png" alt="">
			</div>
			<div class="upload-img">
				<p></p>
				<label class="upload">
					<div data-img="img-area" class="send-add" >
				<img class="img-responsive" style="width:120px;height:160px;display:none" id="img-area" src="images/chengyi/title.png" alt="">
				</div>
					<p id="click" style="position:relative;top:-55px"  >上传你的照片</p>
				</label>
				<label class="upload">
					<div data-img="img-area2" class="send-add" >
				<img class="img-responsive" style="width:120px;height:160px;display:none" id="img-area2" src="images/chengyi/title.png" alt="">
				</div>
					<p id="click2" style="position:relative;top:-55px" >上传TA的照片</p>
				</label>
			</div>
			<div class="btn-con">
				<div id="input"></div>
				<div id="input1"></div>
				<a class="red-btn yf-post" data-type="yes" ng-click="yfpost()" >测测夫妻相指数</a>
				<p>惊艳戒指免费送</p>
			</div>
		</div>
		
		<div class="alert" id="alert2" style="padding:15px" >
			<div id="msg" class="fs3"></div>
			<a href="javascript:void(0)" class="alert-btn fc1 fs3">确定</a>
		</div>
		</form>
		<script src="js/yf.js"></script>
		<script>
		
			function showMsg(msg)
			{
				$("#msg").text(msg);
				$('div#alert2').show();
			}
			$(function(){
				
				
				$('a.alert-btn').click(function (e) {
					$('div.alert').hide();
				});
				
			});
			function get_form_data(){
				var data = {};
				var data_arr = $('form').serialize().replace(/\+/g,' ').split('&');
				console.info(data_arr);
				for(var i=0;i<data_arr.length;i++)
				{
					var temp=data_arr[i].split('=');
					if(typeof(data[hungry.util.utf8_decode(temp[0])])!='undefined')
					{
						var arr=[];
						if(data[hungry.util.utf8_decode(temp[0])] instanceof Array)
						{
							arr=data[hungry.util.utf8_decode(temp[0])];
						}
						else
						{
							arr.push(data[hungry.util.utf8_decode(temp[0])]);
						}
							arr.push(hungry.util.utf8_decode(temp[1]));
							data[hungry.util.utf8_decode(temp[0])]=arr;
					}
					else
					{
						data[hungry.util.utf8_decode(temp[0])]=hungry.util.utf8_decode(temp[1]);
					}
				}
				
				return data;
			}
			
				/* 图片上传  －  start */
			var num = 0; 
			
			var images = {
			    localId: [],
			    serverId: []
			  };
			
			$('.send-add').click(function(){
				var area = $(this).attr("data-img");
				num=0;
				wx.chooseImage({
					success: function (res) {
				        images.localId = res.localIds;
				        if (images.localId.length == 0) {
				  	      	showMsg('请先选择图片');
							return;
				  	    }
				        
				        if(area=="img-area")
      		    		{
      		    			$("#click").html("上传ing");
      		    		}
				        else
				        {
				        	$("#click2").html("上传ing");
				        }
				        var i = 0; 
				        var length = images.localId.length;
				        images.serverId = [];
				        function upload() 
				        {
							
							if(num>=1)
							{
								
								return;
							}
							
							
							
							
							var img;
							
				        	wx.uploadImage({
				        		localId: images.localId[i],
				      		    success: function (res) {
				      		    	i++;
				      		    	num++;
				      		    	images.serverId.push(res.serverId);
				      		    	img = res.serverId;
				      		    	var url = baseUrl+"/index.php?g=mobile&m=picture&a=upload_img";
				      		    	$.post(url,{ img:img,area:area },function(result){
				      		    		
				      		    		
				      		    		if(result.error == 0)
				      		    		{
				      		    		$("#"+area).attr("src",result.img);
										$("#"+area).show();
				      		    		if(area=="img-area")
				      		    		{
				      		    			$("#click").hide();
				      		    			$("#input").html(result.content);
				      		    		}
				      		    		else
			      		    			{
				      		    			$("#click2").hide();
				      		    			$("#input1").html(result.content);
			      		    			}
										
											//$(result.content).appendTo('.jp-textarea');
											
											
				      		    			if(i < length) 
						      	          	{
						      	            	upload();
						      	          	}
				      		    			if(i == length)
				      		    			{
												
											}
											
												
				      		    			
				      		    		}
				      		    		else
				      		    		{
				      		    			showMsg('上传失败');
				      		    			return;
				      		    		}
				      		    	},'json');
				      		    }
				        	});
				        }
				        
				        upload();
				    }
				});
			});

			/* 图片上传  －  end */
			
		</script>
